//package com.manlost.backoffice.controller.upload;
//
//import java.io.IOException;
//
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.ModelMap;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import com.manlost.biz.ManlostServiceLocator;
//import com.manlost.biz.baby.BabyService;
//import com.manlost.ftp.util.FtpUtil;
//import com.manlost.upload.model.constant.FTPConstant;
//
///**
// * @author: HuJianbo (hujianbo88@sohu.com)
// * @date: 2012-4-15
// * @description:
// */
//@Controller
//@RequestMapping("/upload/upload2Service.htm")
//public class Upload2ServiceController {
//
//    private BabyService babyService = ManlostServiceLocator.getBabyService();
//
//    @RequestMapping
//    public String upload2Service(ModelMap model) {
//        System.err.println("test");
//        // babyService.
//
//        // =================
//        FtpUtil ftp = new FtpUtil();
//        try {
//            // connect to ftp server
//            ftp.connectServer(FTPConstant.URL, FTPConstant.USER, FTPConstant.PASSWORD, FTPConstant.SERVER_PATH);
//            System.out.println("======into upload2Service =========");
//            // upload batch files
//            for (String filename : ftp.getFilesFromLocal(FTPConstant.UPLOAD_PATH)) {
//                String realPath = FTPConstant.UPLOAD_PATH + "/" + filename;
//                System.out.println("filesize:" + ftp.upload(realPath) + "bytes");
//            }
//
//            return "upload/uploadOk";
//
//        } catch (IOException ioe) {
//            ioe.printStackTrace();
//            System.out.println("connect to server error!");
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            try {
//                ftp.closeServer();
//            } catch (IOException ioe2) {
//                ioe2.printStackTrace();
//            }
//
//        }
//
//        return "upload/error;";
//    }
//}
